package com.jxust.debate.feign;

import com.jxust.debate.util.CommonResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.concurrent.TimeUnit;

/**
 * @author tyeerth
 * @date 2020/12/27 - 15:32
 */
@Component
@FeignClient("nacos-redis-provider")
public interface RedisService {
    @RequestMapping("/setRedisKeyAndValue")
    public CommonResult<String> setRedisKeyValueRemote(
            @RequestParam("key") String key,
            @RequestParam("value") String value);

    @RequestMapping("/setRedisKeyAndValueWithTimeOut")
    public CommonResult<String> setRedisKeyValueRemoteWithTimeout(
            @RequestParam("key") String key,
            @RequestParam("value") String value,
            @RequestParam("time") long time,
            @RequestParam("timeUnit") TimeUnit timeUnit);

    @RequestMapping("/getRedisValueByKey")
    public CommonResult<String>  getRedisStringValueByKeyRemote(@RequestParam("key") String key);

    @RequestMapping("/removeRedisKey")
    public CommonResult<String> removeRedisKeyRemote(@RequestParam("key") String key);
}
